package com.beehoo.dcportal.service.impl;

import java.util.List;

import com.beehoo.dcportal.common.base.BaseException;
import com.beehoo.dcportal.dao.ICommentDao;
import com.beehoo.dcportal.model.CommentBean;
import com.beehoo.dcportal.service.ICommentServ;

public class CommentServImpl implements ICommentServ {
	private ICommentDao commentDao;

	public ICommentDao getCommentDao() {
		return commentDao;
	}

	public void setCommentDao(ICommentDao commentDao) {
		this.commentDao = commentDao;
	}

	/**
	 * 获取信息评论列表
	 * @param streetId
	 * @param msgId
	 * @param pageNo
	 * @param rows
	 * @return
	 * @throws BaseException
	 */
	public List<CommentBean> getCommentList(String streetId, String msgId, int pageNo, int pageRows) throws BaseException{
		return commentDao.getCommentList(streetId, msgId, ICommentDao.CommentStatus.PUBLISHED, pageNo, pageRows);
	}
	
	/**
	 * 获取信息评论总数
	 * @param streetId
	 * @param msgId
	 * @return
	 * @throws BaseException
	 */
	public int getCommentCount(String streetId, String msgId) throws BaseException {
		return commentDao.getCommentCount(streetId, msgId, ICommentDao.CommentStatus.PUBLISHED);
	}
	
	/**
	 * 添加信息评论
	 * @param comment
	 * @return
	 * @throws BaseException
	 */
	public void addComment(CommentBean comment) throws BaseException{
		commentDao.addComment(comment);
	}
}
